import config from "@/config"
import http from "@/utils/request"

export default {
	token: {
		url: `${config.API_URL}/login`,
		name: "登录",
		post: async function(data={}){
			return await http.post(this.url, data);
		}
	},
	getCode: {
		url: `${config.API_URL}/code`,
		name: "获取验证码",
		get: async function(params){
			return await http.get(this.url);
		}
	},
	register: {
		url: `${config.API_URL}/register`,
		name: "用户注册",
		post: async function(data={}){
			return await http.post(this.url, data);
		}
	},
	userInfo: {
		url: `${config.API_URL}/system/user/getInfo`,
		name: "用户信息",
		get: async function(){
			return await http.get(this.url);
		}
	},
	getLoginMenu: {
		url: `${config.API_URL}/system/menu/getRouters`,
		name: "获取导航",
		get: async function(){
			return await http.get(this.url);
		}
	},
	getNavMenu: {
		url: `${config.API_URL}/system/menu/list`,
		name: "导航树形结构",
		get: async function(params){
			return await http.get(this.url, params);
		}
	},
	editMenu: {
		url: `${config.API_URL}/system/menu`,
		name: "新增/修改菜单信息",
		add: async function(data){
			return await http.post(this.url, data);
		},
		edit: async function(data={}){
			return await http.put(this.url, data);
		},
		delete: async function(data={}){
			return await http.delete(this.url + '/' + data.menuId);
		}
	},
	getUserList: {
		url: `${config.API_URL}/system/user/list`,
		name: "查询用户列表",
		get: async function(params){
			return await http.get(this.url, params);
		}
	},
	getUserDetail: {
		url: `${config.API_URL}/system/user`,
		name: "用户详情",
		get: async function(params){
			console.log(params, 'params')
			return await http.get(this.url + '/' + params.userId);
		}
	},
	editUser: {
		url: `${config.API_URL}/system/user`,
		name: "新增/修改用户信息",
		add: async function(data){
			return await http.post(this.url, data);
		},
		edit: async function(data={}){
			return await http.put(this.url, data);
		},
		delete: async function(data={}){
			return await http.delete(this.url + '/' + data.userId);
		}
	},
	editUserStatus: {
		url: `${config.API_URL}/system/user/changeStatus`,
		name: "用户状态修改",
		put: async function(data={}){
			return await http.put(this.url, data);
		}
	},
	


	deptTreeSelect: {
		url: `${config.API_URL}/system/user/deptTree`,
		name: "查询部门下拉树结构",
		get: async function(params){
			return await http.get(this.url, params);
		}
	},


	editMenuInfo: {
		url: `${config.API_URL}/api/Sys/Menu/Info`,
		name: "修改菜单信息",
		put: async function(data={}){
			return await http.put(this.url, data);
		}
	},
	deltMenu: {
		url: `${config.API_URL}/api/Sys/Menu/Batch`,
		name: "删除菜单",
		delete: async function(data={}){
			return await http.delete(this.url, data);
		}
	},
	getEnmu: {
		url: `${config.API_URL}/api/Tool/Enmu`,
		name: "导航树形结构",
		get: async function(params){
			return await http.get(this.url, params);
		}
	},
	getTaxDistrict: {
		url: `${config.API_URL}/api/Tool/CityArea/TaxDistrict`,
		name: "获取税区列表",
		get: async function(params){
			return await http.get(this.url, params);
		}
	},
}
